<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Gym Rat | View Shared Routine</title>
</head>
<body>
<jsp:include page="/includes/nav.jsp" />
<h1>Viewing Public Routine: ${routine.name }:</h1>
<ul>
	<li>Add this routine to your list using the button below.</li>
	<li>You cannot edit this routine, but if you add it to your list,
	you can modify your personal copy there</li>
</ul>
<h2>Description:</h2>
<p> ${routine.description }</p>
<h2>Entries in this Routine:</h2>
<form action="copy" method="post">
<table width="100%">
	<tr class="tableHeader">
		<td>Exercise</td>
		<td>Variations</td>
		<td>Muscle Group</td>
		<td>Order</td>
		<td>Sets</td>
		<td>Reps</td>
	</tr>

	<c:if test="${routine != null}">
		<c:forEach var="entry" items="${routine.entries}" varStatus="status">
			<c:choose>
				<c:when test="${status.count % 2 == 1 }">
					<c:set var="rowClass" value="tableOddRow" />
				</c:when>
				<c:otherwise>
					<c:set var="rowClass" value="tableEvenRow" />
				</c:otherwise>
			</c:choose>
			<tr class="${rowClass}">
				<td><a
					href="<c:url value='/exercise/info?id=${entry.exerciseId}' />">${entry.exercise}</a></td>
				<td><c:forEach var="variation" items="${entry.variations }">
				${variation.value},
				</c:forEach></td>
				<td>${entry.muscleGroup}</td>
				<td>${entry.order}</td>
				<td>${entry.sets}</td>
				<td>${entry.reps}</td>
			</tr>
		</c:forEach>
	</c:if>
	<tr class="tableHeader">
		<td><input type="button" name="copyroutine" value="Add Routine"
			onClick="submit()" /></td>
		<td></td>
		<td></td>
		<td></td>
		<td><input type="hidden" name="routineId" value="${routine.id}"></td>
		<td></td>
	</tr>
</table>
</form>

</body>
</html>